using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace AresControls
{
	public class HCheckBox : HControl
	{
		private string m_DefaultStyle = "";
		private bool m_DefaultValue;

		public HCheckBox()
		{
			m_DefaultStyle = ";height:18px;color:#442200;background-color:#FFFFFF;";
			m_DefaultValue = false;
		}

		new public bool DefaultValue
		{
			get { return m_DefaultValue; }
			set { m_DefaultValue = value; }
		}

		protected override void Render(HtmlTextWriter output)
		{
			StringBuilder sb = new StringBuilder();

			sb.Append("<input onkeydown=\"OnHControlKeyDown(this);\" type=\"checkbox\" name="+UniqueID+" onbeforedeactivate=\"OnHCheckBoxBlur(this);\" onactivate=\"OnHCheckBoxFocus(this);\" onclick=\"OnHCheckBoxClick(this);\" ");
			sb.Append((GridControl)?renderGridControl():"");
			sb.Append((InvokeOnBeforeDeactivate != "")?renderInvokeOnBeforeDeactivate():"");
			sb.Append((InvokeOnChange != "")?renderInvokeOnChange():"");
			sb.Append((InvokeOnActivate != "")?renderInvokeOnActivate():"");
			sb.Append((InvokeOnChangeLine != "")?renderInvokeOnChangeLine():"");
			sb.Append((m_DefaultValue)?" DefaultValue=\"true\" ":"");
			Style += (ReadOnly)?";background-color:"+ReadOnlyColor:"";
			sb.Append((ReadOnly)?" disabled ":"");
			sb.Append((ReadOnly)?renderControlReadOnly():"");
			sb.Append(" ControlType=\"HCheckBox\" ");
			sb.Append(renderGridID());
			sb.Append(" style=\"width:" + Width + m_DefaultStyle + Style + "\" />");
			output.Write(sb.ToString());
		}

	}
}
